package org.jeecg.modules.quartz.job;


import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.business.service.IBusRoomBookingOrdersService;
import org.jeecg.modules.fw.entity.FwLivingJx;
import org.jeecg.modules.fw.service.IFwLivingJxService;
import org.jeecg.modules.fw.service.impl.FwLivingJxServiceImpl;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import javax.annotation.Resource;

/**
 * 全天房 超时房间转按照全天房计费规则转为全天房，新增全天房计费账单，延房。。。
 * todo : 基本逻辑fix 待优化处理
 */
@Slf4j
public class LivingRoomOrderFeeJob implements Job {

    private String parameter;

    public void setParameter(String parameter) {
        this.parameter = parameter;
    }
    @Resource
    private IBusRoomBookingOrdersService bookingOrdersService;
    @Resource
    private IFwLivingJxService fwLivingJxService;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        log.info("改房间费用订单");
        Runnable runnable = () -> bookingOrdersService.syncRoomOverTimeOrder(parameter);
        Thread thread = new Thread(runnable);
        thread.start();
        bookingOrdersService.overTimerBooking(parameter);
        fwLivingJxService.addJxMess(parameter);

        bookingOrdersService.addWillLeaveMess(parameter);
    }
}
